<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@include file="/commons/header.jsp" %>
<div style="margin-left:210px;margin-top:65px;padding:10px 5px 0 5px;">

    <div style="line-height:26px;height:26px;margin-bottom:10px;">
        <h1 style="float:left;font-size:26px;">修改密码</h1>

        <span class="layui-breadcrumb" style="float:right;font-size:12px;">
                <a href="#">首页</a>
                <a><cite>修改密码</cite></a>
            </span>
    </div>
    <div style="margin-left:30px;margin-top:20px;clear:both;">
        <form class="layui-form">

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">原密码</label>
                    <div class="layui-input-inline">
                        <input type="password" lay-verify="required" autocomplete="off"
                               class="layui-input password" id="oldpwd">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">新密码</label>
                    <div class="layui-input-inline">
                        <input type="password" id="newpwd" autocomplete="off" lay-verify="required" class="layui-input password">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">确认密码</label>
                    <div class="layui-input-inline">
                        <input type="password" id="refirmpwd" lay-verify="required" autocomplete="off" class="layui-input password">
                    </div>
                </div>
            </div>


            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="demo1">修改密码</button>
                    <button type="reset" class="layui-btn layui-btn-primary">取消</button>
                </div>
            </div>


        </form>

    </div>
    <script src="${pageContext.request.contextPath}/lib/layui.all.js"/>
    <script src="${pageContext.request.contextPath}/js/jquery-1.7.1.js"></script>

    <script>
        //注意：导航 依赖 element 模块，否则无法进行功能性操作
        layui.use('element', function () {
            var element = layui.element;

            //监听导航点击
            element.on('nav(demo)', function (elem) {
                //console.log(elem)
                //layer.msg(elem.text());
            });
        });

        layui.use(['form', 'layedit', 'laydate'], function () {
            var form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate;
            //监听提交
            form.on('submit(demo1)', function (data) {



                var pwd = $("#oldpwd").val();
                var newpwd = $("#newpwd").val();
                var refirmpwd = $("#refirmpwd").val();


                if (newpwd != refirmpwd) {
                    layer.msg("新密码两次输入不一致哦");

                    return false;
                }

                $.post("${pageContext.request.contextPath}/manager/UserServlet?op=updatepwd", {"oldpwd": pwd, "newpwd": newpwd}, function (datas) {


                    layer.msg(datas["error"]);

                });

                return false;
            });

        });

        layui.use('laydate', function () {
            var laydate = layui.laydate;

        });


    </script>
<%@include file="/commons/footer.jsp" %>